#pragma once


#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
#include <iostream>
#include <stdlib.h>


#ifdef _PC
#define CALLBACK __stdcall
#endif 





#if defined(_DEBUG) || defined(_RELEASE)

// Breakpoint function used to break in code on PC
void Breakpoint();

#if defined(_DEBUG)
#define	DEBUGINFO_S(msg, ...) {char buffer[256]; memset(buffer, '\0', 256); strcpy(buffer, msg); strcat(buffer, "\n");printf( buffer, ##__VA_ARGS__);}
#else
#define	DEBUGINFO_S(msg, ...)
#endif


#define THROW_S(msg, ...) {char buffer[256]; memset(buffer, '\0', 256);sprintf_s( buffer, msg, ##__VA_ARGS__);\
						printf("Throw exception at %s:%d\nExecution exception. Error: %s\n", __FILE__, __LINE__, buffer);\
						char buffer2[512]; memset(buffer2, '\0', 512);\
						sprintf(buffer2, "Throw exception at %s:%d\nExecution exception. Error: %s\n", __FILE__, __LINE__, buffer);\
						throw(buffer2);}


#define EXCEPTION_S(cond, msg, ...) if(!(cond)){ char buffer[256]; memset(buffer, '\0', 256);sprintf_s( buffer, msg, ##__VA_ARGS__);\
												printf("Exception at %s:%d\nExecution exception. Condition: %s -- Error: %s\n", __FILE__, __LINE__, #cond, buffer);\
												Breakpoint();}


#define ASSERT_S(cond) assert(cond);


#else

#define ASSERT_S(cond)
#define THROW_S(msg, ...)
#define EXCEPTION_S(cond, msg, ...)
#define	DEBUGINFO_S(msg, ...)

#endif

